/**
 * 哈夫曼树节点类
 * 
 * @author yangmqglobe
 *
 */
class HuffmanNode {
	private int weight;// 权值
	private boolean flag;// 标记是否已进树
	private HuffmanNode parent, lchild, rchild;// 父节点，以及左右子节点

	/**
	 * 构造方法
	 * 
	 * @param weight
	 *            节点的权值
	 */
	public HuffmanNode(int weight) {
		this.weight = weight;
		this.flag = false;
	}

	public int getWeight() {
		return weight;
	}

	public void setWeight(int weight) {
		this.weight = weight;
	}

	public boolean getFlag() {
		return flag;
	}

	/**
	 * 标记已经进树
	 */
	public void markFlag() {
		this.flag = true;
	}

	public HuffmanNode getParent() {
		return parent;
	}

	public void setParent(HuffmanNode parent) {
		this.parent = parent;
	}

	public HuffmanNode getLchild() {
		return lchild;
	}

	public void setLchild(HuffmanNode lchild) {
		this.lchild = lchild;
	}

	public HuffmanNode getRchild() {
		return rchild;
	}

	public void setRchild(HuffmanNode rchild) {
		this.rchild = rchild;
	}
}
